package cn.tedu._07springaop.aop;


import org.springframework.stereotype.Component;

@Component//标志为组件
public class CalculatorImpl implements Calculator{

    @Override
    public int add(int a, int b) {
//        if (a>0){
//            throw new RuntimeException("参数a不能为正数");
//        }
        int result = a+b;
        System.out.println("执行了加法运算："+a+"+"+b+"="+result);
        return result;
    }

    @Override
    public int sub(int a, int b) {
        int result = a-b;
        return result;
    }

    @Override
    public int mul(int a, int b) {
        int result = a*b;
        return result;
    }

    @Override
    public int div(int a, int b) {
        int result = a/b;
        return result;
    }
}
